package com.tulingxueyuan.sentinelnew.feign;

import com.tulingxueyuan.sentinelnew.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author :tangweiliang
 * @date : 2023/1/31 22:40
 * 未来的你会感谢现在努力的自己
 */
// 2.添加feign接口和方法
/**
 * name 指定调用rest接口所对应的服务名
 * path 指定调用rest接口所在的StockController指定的@RequestMapping
 * configuration = FeignConfig.class
 */
@FeignClient(name = "stock-service",path = "/stock",configuration = FeignConfig.class)
public interface StockFeignService {

     // 声明需要调用的rest接口对应的方法
     @RequestMapping("/reduct")
     String reduct();
}

/**
 *@RequestMapping("/stock")
 * public class StockController {
 *
 *     @Value("${server.port}")
 *     String port;
 *
 *     @RequestMapping("/reduct")
 *     public String reduct(){
 *         System.out.println("扣减库存!");
 *         return "扣减库存:"+port;
 *     }
 * }
 */